//
//  ZMShoppingCarViewController.swift
//  LoveBeen
//
//  Created by pg on 2017/8/6.
//  Copyright © 2017年 pg. All rights reserved.
//

import UIKit

class ZMShoppingCarViewController: ZMBaseController {

    
   
    
    override func viewDidLoad() {
        super.viewDidLoad()

//        if isLogin == false{
//            self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.plain, target: nil, action: nil)
//           self.navigationController?.pushViewController(ZMLoginViewController(), animated: true)
//           
//        }
        
       NotificationCenter.default.addObserver(self, selector: #selector(tabbarNoti(info:)), name: NSNotification.Name("tabbar"), object: nil)
        
      //  self.tabBarController?.selectedIndex = self.lastTabBarIndex
    }
   
    func tabbarNoti(info: Notification) -> Void {
        
        lastTabBarIndex = info.object as! Int
      //  self.tabBarController?.selectedViewController = self.tabBarController!.viewControllers![self.lastTabBarIndex]
        
    }
    
    override var lastTabBarIndex: Int{
        didSet{
          //  self.tabBarController?.selectedViewController = self.tabBarController!.viewControllers![self.lastTabBarIndex]
        }
    }
    
       
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    override func viewDidAppear(_ animated: Bool) {
        //print(lastTabBarIndex)
        super.viewDidAppear(true)
        self.tabBarController?.selectedViewController = self.tabBarController!.viewControllers![self.lastTabBarIndex]
    //    self.tabBarController?.selectedIndex = self.lastTabBarIndex
    }


}
